# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

pkgname=python-aioquic
_name=aioquic
pkgver=0.9.22
pkgrel=1
pkgdesc='QUIC and HTTP/3 implementation in Python'
url='https://github.com/aiortc/aioquic'
arch=('loong64' 'x86_64')
license=('BSD-3-Clause')
depends=(
  'openssl'
  'python'
  'python-certifi'
  'python-cryptography'
  'python-pylsqpack'
  'python-pyopenssl'
  'python-service-identity'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
b2sums=('1a935b36e24b56478b64be30831a9af3d811cdfc6de5736abd9fd8ca3d900f7522f5a0abdef2a058ccd573ea3374cf345850f5dc6fb5222fb3a20486dc55da7d')

build() {
  cd "${_name}-${pkgver}"
  python -m build --wheel --no-isolation
}

check() {
  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd ${_name}-${pkgver}
  python -m installer --destdir=test_dir dist/*.whl

  PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH" python -c '
import aioquic
import aioquic.h3.connection
import aioquic.quic.packet
'
}

package() {
  cd "${_name}-${pkgver}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -D LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim:set ts=2 sw=2 et:
